fix: resolve snippet line-context vars from caret#1354
Merged
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom Oct 24, 2025
Merged
fix: resolve snippet line-context vars from caret#1354sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
sebthom merged 1 commit intoeclipse-lsp4e:mainfrom
Conversation
Compute $TM_LINE_INDEX, $TM_LINE_NUMBER, $TM_CURRENT_LINE from the viewer caret line instead of the TextEdit range. Previously, variables were derived from the edit range, producing incorrect values when the caret was on a different line. Using the viewer caret aligns with snippet semantics and matches user expectations.
Contributor
|
How can it happen that the completion is asked in a different place than the one where the caret is placed? Can a user do that while he is working with the editor? |
Member
Author
An LSP server can return a completion with a textEdit range that differs from the caret position - for example, a multi-line selection/replacement that starts on a previous line. It can also use insert/replace ranges or additionalTextEdits to modify other locations (e.g., adding imports). |
rubenporras
approved these changes
Oct 24, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compute $TM_LINE_INDEX, $TM_LINE_NUMBER, $TM_CURRENT_LINE from the viewer caret line instead of the TextEdit range.
Previously, variables were derived from the edit range, producing incorrect values when the caret was on a different line. Using the viewer caret aligns with snippet semantics and matches user expectations.